package com.li.search;

import com.sun.org.apache.xpath.internal.operations.String;

public class OrderSearch {
    public static void main(String[] args) {
        int[] arr = {53, 3, 542, 748, 14, 214};
        int index = search(arr, 3);
        if (index != -1) {
            System.out.println("找到了，下标为" + index);
        } else {
            System.out.println("没有找到");
        }
    }

    public static int search(int[] arr, int n) {
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] == n) {
                return i;
            }
        }
        return -1;

    }
}
